<?php
include("connection/connection.php");
$typeScheme=$_POST['typeScheme'];
$frm=$_POST['frmId'];
if(isset($_POST['submit']))
{
$source=$_POST['source'];
$sourceId=$_POST['sourceId'];
$yeildMin=$_POST['yeildMin'];
$yeildMax=$_POST['yeildMax'];
$waterMin=$_POST['waterMin'];
$waterMax=$_POST['waterMax'];
$Location=$_POST['Location'];
$Longitude=$_POST['Longitude'];
$Latitude=$_POST['Latitude'];
$source_status=$_POST['source_status'];

$pH=$_POST['pH'];
$TDS=$_POST['TDS'];
$cl=$_POST['cl'];
$F=$_POST['F'];
$no3=$_POST['no3'];
$testing_date=$_POST['esting_date'];
$qr="update tbl_dtls_q1_sws set source='$source',location='$Location' ,longitude='$Longitude',latitude='$Latitude',yield_min='$yeildMin',yield_max='$yeildMax',water_table_min='$waterMin',water_table_max='$waterMax',current_status='$source_status' ,pH='$pH',TDS='$TDS',Cl='$cl',F='$F',no3='$no3',testing_date='$testing_date' where id='$sourceId'";
$res=mysql_query($qr);
////////////////////////code for maintaining user history///////////////////
	if($typeScheme=="P&T" || $typeScheme=="TSS(P&T)")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','3','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	if($typeScheme=="Piped")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','29','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	if($typeScheme=="Sanitary Diggs")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','55','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	
	
	mysql_query($qryHistory);
	///////////////////////////////


if($res)
{
header("location:q1.php");
}
}		
?>